<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>思维导图</title>

    <style>
        body {
            margin: 0;
            overflow: hidden;
        }
        #myCanvas {
            width: 100vw;
            height: 100vh;
            display: block;
        }
        #nodeEditor {
            position: absolute;
            display: none;
            z-index: 1000;
            border: 1px solid #ccc;
            background: white;
            padding: 8px;
            border-radius: 4px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            outline: none;
        }
        #contextMenu {
            position: fixed;
            background: white;
            border: 1px solid #ccc;
            box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
            display: none;
            z-index: 1000;
        }
        #contextMenu div {
            padding: 8px 12px;
            cursor: pointer;
        }
        #contextMenu div:hover {
            background: #f0f0f0;
        }
    </style>
    <canvas id="myCanvas"></canvas>
    <textarea id="nodeEditor"></textarea>
    <div id="contextMenu">
        <div id="addChild">添加子节点</div>
        <div id="addSibling">添加兄弟节点</div>
    </div>

    <script type="module">
        import { MindMap } from './MindMap.js';

        const mindMap = new MindMap({
            canvas: document.getElementById('myCanvas'),
            input: document.getElementById('nodeEditor'),
            data: {
                id: 1,
                text: '中心思想',
                children: [
                    { id: 2, text: '分支1',tags:["xx",'88'], children: [{ id: 2, text: '分支11', children: [] },
                            { id: 3, text: '分支21', children: [] }] },
                    { id: 3, text: '分支2', children: [{ id: 2, text: '分支12', children: [] },
                            { id: 3, text: '分支22', children: [] }] },

                ]
            }
        });

        mindMap.render();
    </script>

</head>



